#ifndef    __BU_INTER_H__
#define    __BU_INTER_H__


#include "stdint.h"

#define   PRO_ERR              0xE0


#define   PRO_HEAD_H           0xA5
#define   PRO_HEAD_L           0x5A
#define   PRO_INFO             0x01
#define   PRO_CALL             0x02
#define   PRO_OPENDOOR         0x03
#define   PRO_CLOSEDOOR        0x04


#define   PRO_VB               0x81


typedef struct st_inter{
	uint8_t ack_flag;
	uint8_t ack_sn0;
	uint8_t ack_sn1;
	uint8_t ack_cmd;
	uint8_t res_flag;
	uint8_t res_send_cnt;
	void (*init)(void);
	void (*conver)(void);
	void (*recv_data_deal)(void);
}st_inter,*pst_inter;

typedef struct RES_485{
	uint8_t r_len;
	uint8_t r_sn0;
	uint8_t r_sn1;
	uint8_t r_cmd;
	uint8_t r_res;
	uint8_t r_unuse0;
	uint8_t r_unuse1;
	uint8_t r_unuse2;
}RES_485;

typedef struct ACK_485{
	uint8_t a_len;
	uint8_t a_sn0;
	uint8_t a_sn1;
	uint8_t a_cmd;
}ACK_485;

typedef struct PAYLOAD_485{
	uint8_t d_len;
	uint8_t ser_mode;
	uint8_t run_dir;
	uint8_t acd_num;
	uint8_t comfort;
	uint8_t dis_floor;
	uint8_t phy_floor;
	uint8_t speed_h;
	uint8_t speed_l;
	uint8_t safe_bit;
	uint8_t mdoor_bit;
	uint8_t sdoor_bit;
	uint8_t m1_8_incall;
	uint8_t m6_16_incall;
	uint8_t m17_24_incall;
	uint8_t m25_32_incall;
	uint8_t m33_40_incall;
	uint8_t m41_48_incall;
	uint8_t s1_8_incall;
	uint8_t s6_16_incall;
	uint8_t s17_24_incall;
	uint8_t s25_32_incall;
	uint8_t s33_40_incall;
	uint8_t s41_48_incall;
}PAYLOAD_485;

typedef struct FRAME_R485{
	uint8_t head_H;
	uint8_t head_L;
	uint8_t sn_H;
	uint8_t sn_L;
	uint8_t cmd;
	uint8_t len;
	uint8_t sum;
	uint8_t sum1;
	struct ACK_485 ack;
	uint8_t data[0];
}FRAME_R485;

typedef struct FRAME_T485{
	uint8_t head_H;
	uint8_t head_L;
	uint8_t sn_H;
	uint8_t sn_L;
	uint8_t cmd;
	uint8_t len;
	uint8_t sum;
	uint8_t sum1;
	struct RES_485 res;
	struct ACK_485 ack;
	struct PAYLOAD_485 data;
}FRAME_T485;




extern pst_inter p_inter;
void inter_business_init(void);

#endif


